using System;
using ValidationFramework;

namespace ExampleLibraryCSharp
{

    public class RequiredByteRuleAttributeExample
    {
        private static readonly RuntimeMethodHandle doSomethingHandle =
            typeof(RequiredByteRuleAttributeExample).GetMethod("DoSomething").MethodHandle;

        [RequiredByteRule]
        [RequiredByteRule(InitialValue = 2, ErrorMessage = "2 is an invalid value.")]
        public byte Data
        {
            get;
            set;
        }


        public void DoSomething(
         [RequiredByteRule] byte paramData)
        {
            ParameterValidationManager.ThrowException(this, doSomethingHandle, paramData);
        }
    }
}